/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86136
 * Date: 2024-05-21
 * Time: 21:24
 */
class Student {
    private String name;
    private int age;
    private double score;

    {
        this.name = "bit";
        this.age = 5;
        this.score = 98.6;
        Student.getClassName();
        System.out.println("构造代码块，也叫实例代码块，一般用于初始化实例成员变量");
    }

    static {
        className = " 112";
        System.out.println(Student.getClassName());
        System.out.println("静态代码块，一般用于初始化静态成员变量");
    }
    public static String className = " 113";

    public Student() {
        System.out.println("这是一个无参的构造方法");
    }

    public Student(String name,int age,double score) {
        this.name = name;
        this.age = age;
        this.score = score;
        System.out.println("这是一个含有3个参数的构造方法");
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public double getScore() {
        return score;
    }

    public void setScore(double score) {
        this.score = score;
    }

    public static void setClassName(String className) {
        Student.className = className;
    }

    public static String getClassName() {
//        Student student = new Student();
        /*student.show();
        this.name;*/
        return Student.className;
    }
    public void eat() {
        System.out.println(this.name + "吃东西");
    }

    public void doClass() {
        System.out.println(this.name + "正在上课");
    }

    private void fuc() {
        System.out.println("这个方法为本类其他访问服务的，不对外公开");
    }

    public void show() {
        System.out.println("姓名：" + this.name + " 年龄：" + this.age +
                " 学号：" + this.score + Student.className);
        getClassName();
    }

    public String toString() {
        return "{ student:" +"姓名：" + this.name + " 年龄：" + this.age +
                " 学号：" + this.score + Student.className + " }";
    }

}
public class Test {
    public static void main(String[] args) {
        Student student = new Student();
        System.out.println(student.toString());
    }
    public static void main4(String[] args) {
        Student student = new Student();
        System.out.println("==================");
        Student student1 = new Student();

    }
    public static void main3(String[] args) {
        {
            int a = 10;
            System.out.println(a + "普通代码块,普通方法区");
        }
    }
    public static void main2(String[] args) {
        Student student = null;
        System.out.println(Student.getClassName());
    }
    public static void main1(String[] args) {
        Student.setClassName(" 2班");
        Student student1 = new Student("陈俊燕",19,89.9);
        student1.show();

        Student student2 = new Student("王一博",26,99.9);
        student2.show();

        Student student3 = new Student("周颖",19,95.9);
        student3.show();

    }
}
